package com.xzq.wanandroid.base.application;

import android.app.Application;

import androidx.appcompat.app.AppCompatDelegate;

import com.blankj.utilcode.util.SPUtils;
import com.blankj.utilcode.util.SpanUtils;
import com.blankj.utilcode.util.Utils;
import com.xzq.wanandroid.API.ApiAdress;


import org.litepal.LitePal;
import org.litepal.LitePalApplication;


/**
 * @ClassName : WanAndroidApplication
 * @Description : application
 * @Author : xzq
 * @Date: 2021-05-08 09:24
 * @Version :
 */
public class WanAndroidApplication extends LitePalApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        LitePal.initialize(this);
        Utils.init(this);
        initMode();
    }

    private void initMode() {
        //初始化夜间模式
        boolean isNightMode = SPUtils.getInstance(ApiAdress.CONFIG_SETTINGS).getBoolean
                (ApiAdress.KEY_NIGHT_MODE, false);
        AppCompatDelegate.setDefaultNightMode(isNightMode?AppCompatDelegate.MODE_NIGHT_YES:AppCompatDelegate.MODE_NIGHT_NO);
    }
}


